﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Housing;

public partial class HouseKeep_ModifyApply : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["id"] != null && Request["applyid"] != null && Session["UserId"] != null)
        {
            if (!IsPostBack)
            {
                BindDate();
                BindDocument();
                PageBind();
            }
            SystemItems systemitem = new SystemItems();
            systemitem.GetNewestSystemItem();
            if (systemitem != null)
            {
                otherrentstandard.Value = systemitem.Sys_otherrentstandard;
                lowrentstandard.Value = systemitem.Sys_lowrentstandard;
                onlyonearea.Value = systemitem.Sys_onlyonearea;
                homeavgarea.Value = systemitem.Sys_avgarea;
                standardlowarea.Value = systemitem.Sys_standardlowarea;
            }
            lblnoid.Text = Request.QueryString["id"].ToString();
        }
        else
            WebHelper.AlertAndClose("登陆超时或页面出错，请重新进入");
    }
    private  string dtime;
    protected void PageBind()
    {
        string applyid = Request.QueryString["applyid"].ToString();
        //读取申请表信息
        Apply apply = new Apply(applyid);
        if (apply != null)
        {
		//修改
            txbname.Text = apply.apply_name;
            ddlmarryed.SelectedValue = apply.Marryed;
            txbunit.Text = apply.Workunit;
            txbcard.Text = apply.Idcard;
            txbincome.Text = apply.Income;
            lblStreet.Text = apply.apply_street;

            txbaddress.Text = apply.apply_address;
            txbphone.Text = apply.apply_phone;
            txbtotleincome.Value = apply.apply_yearincome.ToString();
            txbpeoplenum.Value = apply.apply_peoplenum.ToString();
            txbavgincome.Value = apply.apply_avgincome.ToString();
            txbavgmonthincome.Value = (apply.apply_avgincome / 12).ToString();
            txbtotleproperty.Value = apply.apply_totlepropertity.ToString();
            txbtotlearea.Value = apply.apply_totlearea.ToString();
            txbavgarea.Value = apply.apply_avgarea.ToString();
            ViewState["longid"] = apply.apply_longid;
            txbapplytime.Text = Convert.ToDateTime(apply.apply_time).ToString("yyyy年MM月dd日");
            dtimebox.Text = apply.apply_time;
            dtime = apply.apply_time;
            if (apply.apply_paybycard != "0")
            {
                chkcard.Checked = true;
                chkmoney.Checked = false;
                txbcardnum.Text = apply.apply_paybycard;
            }
            else
                chkmoney.Checked = true;
            rbldoc.SelectedIndex = rbldoc.Items.IndexOf(rbldoc.Items.FindByText(apply.apply_docname));
            show.InnerHtml = rbldoc.SelectedValue;
            txbproofnum.Text = apply.apply_docnum;
            if (!string.IsNullOrEmpty(apply.apply_docdate))
            {
                ddlyear4.SelectedValue = apply.apply_docdate.Substring(0, 4);
                ddlmonth4.SelectedValue = apply.apply_docdate.Substring(4, 2);
            }
        }
        //读取申请人家庭情况
        SqlDataReader drApplicant = new Applicant().GetApplicantByApplyidEdit(applyid);
        string html = "";
        int count = 0;
        while (drApplicant.Read())
        {
            html += "<table width='100%' border='1' cellspacing='0' style='border-top:none; border-bottom:none; border-left:none; border-right:none'  id='AppNode" + count + "'>";
            html += "<tr>";
            html += "<td width='56px' height='50'><input type='text' name='txbapplytitle" + count + "' style='width:90%' class='UnderlineButton1' value='" + drApplicant["app_title"].ToString() + "'></td>";
            html += "<td width='58px'><input type='text' name='txbname" + count + "' style='width:90%' class='UnderlineButton1' value='" + drApplicant["app_name"].ToString() + "'></td>";
            if (drApplicant["app_marryed"].ToString() == "已婚")
                html += "<td width='59px'><select name='ddlmarry" + count + " '><option>已婚</option><option>未婚</option></select></td>";
            else
                html += "<td width='59px'><select name='ddlmarry" + count + " '><option>未婚</option><option>已婚</option></select></td>";
            html += "<td width='212px'><input type='text' name='txbunit" + count + "' style='width:90%' class='UnderlineButton1' value='" + drApplicant["app_workunit"].ToString() + "'></td>";
            html += "<td width='214px'><input type='text' name='txbcard" + count + "' style='width:90%' class='UnderlineButton1' value='" + drApplicant["app_idcard"].ToString() + "'></td>";
            html += "<td width='168px'><input type='text' name='txbincome" + count + "' style='width:90%' class='UnderlineButton1' value='" + drApplicant["app_income"].ToString() + "' onblur='Totleincome(\"txbincome" + count + "\",\"text_val" + count + "\");' onkeydown = 'DigitInput(this,event);'><input type='hidden' id='text_val" + count + "' value='" + drApplicant["app_income"].ToString() + "' /></td>";
            if (drApplicant["app_ispro"].ToString() == "1")
                html += "<td width='72px'>&nbsp;&nbsp;<input type='checkbox' id='ckbispro" + count + "' checked name='ckbispro" + count + "' onclick='CountIsproNum(\"ckbispro" + count + "\")'></td>";
            else
                html += "<td width='72px'>&nbsp;&nbsp;<input type='checkbox' id='ckbispro" + count + "' name='ckbispro" + count + "' onclick='CountIsproNum(\"ckbispro" + count + "\")'></td>";
            if(count>=0)
                html += "<td width='38px'><input type='button' value='删除' name='del" + count + "' onclick='DelRowApplication(" + count + ");'/></td>";
            else
                html += "<td width='38px'> &nbsp;</td>";
            html += "</tr></table>";
            count++;
        }
        appcount.Value = count.ToString();
        ApplyTextHtml.Text = html;
        drApplicant.Close();
        //读取财产情况
        Property property = new Property(applyid);
        if (property != null)
        {
            
            txbsecuritie.Text = money1.Value = Convert.ToString(property.pro_securitie);
            txbestate.Text = money2.Value = Convert.ToString(property.pro_estat);
            txbdevice.Text = money3.Value = Convert.ToString(property.pro_device);
            txbothers.Text = money4.Value = Convert.ToString(property.pro_other);
        }
        //读取保障类型情况
        string noid = Request.QueryString["id"].ToString();
        SubsidyRecord subsidyrecord = new SubsidyRecord();
        subsidyrecord.GetNewestSubsidyRecordByNoid(noid);
        if (subsidyrecord.Adj_id > 0)
        {
            ckbsubsidy.Checked = true;
            ViewState["sub"] = true;
            ViewState["area"] = subsidyrecord.Adj_nowarea;
            ViewState["money"] = subsidyrecord.Adj_nowmoney;
            string subhtml = "";
            subhtml = "补贴建筑面积为:" + subsidyrecord.Adj_nowarea;
            subhtml += "<br/>月补贴金额为:" + subsidyrecord.Adj_nowmoney;
            subsidy.InnerHtml = subhtml;
            this.submoney.Value = subsidyrecord.Adj_nowmoney;
            if (!string.IsNullOrEmpty(subsidyrecord.Adj_stoptime))
            {
                ddlyear1.SelectedValue = subsidyrecord.Adj_stoptime.Substring(0, 4);
                if (subsidyrecord.Adj_stoptime.Substring(4, 1) == "1")
                    ddlmonth1.SelectedValue = subsidyrecord.Adj_stoptime.Substring(4, 2);
                else
                    ddlmonth1.SelectedValue = subsidyrecord.Adj_stoptime.Substring(5, 1);
            }
        }
        ReduceRecord reducerecord = new ReduceRecord();
        reducerecord.GetNewestReduceRecordBynoid(noid);
        if (reducerecord.Adj_id > 0)
        {
            ckbreduce.Checked = true;
            ViewState["red"] = true;
            //ckbreduce.Enabled = false;
            ddlyear2.Enabled = false;
            ddlmonth2.Enabled = false;
            string redhtml = "";
            redhtml = "承&nbsp;&nbsp;租&nbsp;&nbsp;人&nbsp; ：<input type='text' name='username' class='UnderlineButton1' disabled='disabled' value='" + reducerecord.Adj_renter + "'><br/>";
            redhtml += "承 租 地 址 ：<input type='text' name='address' class='UnderlineButton1' disabled='disabled' value='" + reducerecord.Adj_rentaddress + "'><br/>";
            redhtml += "住房计租面积：<input type='text' name='area' class='UnderlineButton1' disabled='disabled' value='" + reducerecord.Adj_nowarea + "'><br/>";
            redhtml += "核定月租金&nbsp;&nbsp;：<input type='text' name='checkmoney' disabled='disabled' class='UnderlineButton1' value='" + reducerecord.Adj_nowmoney + "'><br/>";
            redhtml += "月减免租金额：<input type='text' name='reducemoney' disabled='disabled' class='UnderlineButton1' value='" + reducerecord.Adj_nowreduce + "'><br/>";
            if (!string.IsNullOrEmpty(reducerecord.Adj_stoptime))
            {
                ddlyear2.SelectedValue = reducerecord.Adj_stoptime.Substring(0, 4);
                if (reducerecord.Adj_stoptime.Substring(4, 1) == "1")
                    ddlmonth2.SelectedValue = reducerecord.Adj_stoptime.Substring(4, 2);
                else
                    ddlmonth2.SelectedValue = reducerecord.Adj_stoptime.Substring(5, 1);

            }
            reduce.InnerHtml = redhtml;
        }
        else
            ckbreduce.Checked = false;
        KindRecord kindrecord = new KindRecord();
        kindrecord.GetNewestKindRecordBynoid(noid);
        if (kindrecord.Adj_id > 0)
        {
            ckbkind.Checked = true;
            ViewState["kind"] = true;
            //ckbkind.Enabled = false;
            ddlyear3.Enabled = false;
            ddlmonth3.Enabled = false;
            string kindhtml = "";
            kindhtml = "房屋座落：<input type='text' name='houseaddress' disabled='disabled' class='UnderlineButton1' value='" + kindrecord.Adj_location + "'><br/>";
            kindhtml += "建筑面积：<input type='text' name='housearea' disabled='disabled' class='UnderlineButton1' value='" + kindrecord.Adj_nowarea + "'><br/>";
            kindhtml += "使用面积：<input type='text' name='usearea' disabled='disabled' class='UnderlineButton1' value='" + kindrecord.Adj_nowuserarea + "'><br/>";
            if (!string.IsNullOrEmpty(reducerecord.Adj_stoptime))
            {
                ddlyear3.SelectedValue = kindrecord.Adj_stoptime.Substring(0, 4);
                if (kindrecord.Adj_stoptime.Substring(4, 1) == "1")
                    ddlmonth3.SelectedValue = kindrecord.Adj_stoptime.Substring(4, 2);
                else
                    ddlmonth3.SelectedValue = kindrecord.Adj_stoptime.Substring(5, 1);
            }
            kind.InnerHtml = kindhtml;
        }
        else
            ckbkind.Checked = false;
        //读取住房状况
        string houhtml = houses.InnerHtml;
        int houcount = 0;
        int mmm = 1;
        SqlDataReader drhou = new HouseSituation().GetHouseSituationByapplyid(applyid);
        while (drhou.Read())
        {
            houhtml += "<table width='100%' border='1' cellspacing='0'  style='border-top:none; border-bottom:none; border-left:none; border-right:none' id='HousingNode" + houcount + "'>";
            houhtml += "<tr>";
            houhtml += "<td width='25px' style='height: 37px'>" + mmm + "&nbsp;</td>";
            houhtml += "<td style='width:175px;height:37px;'><input type='text' name='txblocal" + houcount + "' value='" + drhou["hou_address"].ToString() + "' class='UnderlineButton1'  style='width:150px'></td>";
            houhtml += "<td style='height:37px;width:80px;'><input type='text' name='txbarea" + houcount + "' value='" + drhou["hou_area"].ToString() + "' id='txbarea" + houcount + "' class='UnderlineButton1' style='width:45px' onblur='OnlyNumber(\"txbarea" + houcount + "\",\"建筑面积\")'></td>";
            houhtml += "<td style='height: 37px; width: 87px;'><input type='text' name='txbowner" + houcount + "' value='" + drhou["hou_owner"].ToString() + "' class='UnderlineButton1' style='width:60px'></td>";
            houhtml += "<td style='width: 129px; height: 37px;'><input type='text' name='txbownproof" + houcount + "' value='" + drhou["hou_ownproof"].ToString() + "' class='UnderlineButton1' style='width:100px'></td>";
            houhtml += "<td style='width: 149px; height: 37px;'><input type='text' name='txbnature" + houcount + "' value='" + drhou["hou_nature"].ToString() + "' class='UnderlineButton1' style='width:100px'></td>";
            houhtml += "<td style='width: 161px; height: 37px;'><input type='text' name='txbremark" + houcount + "' value='" + drhou["hou_remark"].ToString() + "' class='UnderlineButton1' style='width:150px'></td>";
            if (drhou["hou_addcounted"].ToString() == "1")
                houhtml += "<td style='width: 78px; height: 37px;'><input type='checkbox' checked name='ckbaddcount" + houcount + "' onclick='getTotal()'></td>";
            else
                houhtml += "<td style='width: 78px; height: 37px;'><input type='checkbox' name='ckbaddcount" + houcount + "' onclick='getTotal()'></td>";
            if (houcount != 0)
                houhtml += "<td style='width: 42px; height: 37px;'><input type='button' value='删除' name='del" + houcount + "' onclick='DelRowHousing(" + houcount + ");'/></td>";
            else
                houhtml += "<td style='width: 42px; height: 37px;'></td>";
            houhtml += "</tr></table>";
            houcount++;
            mmm++;
        }
        mmmm.Value = mmm.ToString();
        housecount.Value = houcount.ToString();
        drhou.Close();
        houses.InnerHtml = houhtml;
    }
    protected void BindDocument()
    {
        Documents document = new Documents();
        SqlDataReader dr = document.GetAllDocuments();
        int i = 0;
        while (dr.Read())
        {
            rbldoc.Items.Insert(i, new ListItem(dr["doc_name"].ToString(), dr["doc_type"].ToString()));
            i++;
        }
        dr.Close();
    }
    protected void BindDate()
    {
        int year = Convert.ToInt32(DateTime.Now.Year.ToString());
        for (int i = year - 2; i < year + 2; i++)
        {
            ddlyear1.Items.Add(i.ToString());
            ddlyear2.Items.Add(i.ToString());
            ddlyear3.Items.Add(i.ToString());
            ddlyear4.Items.Add(i.ToString());
            startYear.Items.Add(i.ToString());
        }
        for (int i = 1; i < 13; i++)
        {
            ddlmonth1.Items.Add(i.ToString());
            ddlmonth2.Items.Add(i.ToString());
            ddlmonth3.Items.Add(i.ToString());
            ddlmonth4.Items.Add(i.ToString());
            startMonth.Items.Add(i.ToString());
            
        }


        ddlyear1.SelectedValue = DateTime.Now.Year.ToString();
        ddlyear2.SelectedValue = DateTime.Now.Year.ToString();
        ddlyear3.SelectedValue = DateTime.Now.Year.ToString();
        ddlyear4.SelectedValue = DateTime.Now.Year.ToString();
        startYear.SelectedValue = DateTime.Now.Year.ToString();

        ddlmonth1.SelectedValue = DateTime.Now.Month.ToString();
        ddlmonth2.SelectedValue = DateTime.Now.Month.ToString();
        ddlmonth3.SelectedValue = DateTime.Now.Month.ToString();
        ddlmonth4.SelectedValue = DateTime.Now.Month.ToString();
        startMonth.SelectedValue = DateTime.Now.Month.ToString();
    }


    protected void btnupdate_Click(object sender, EventArgs e)
    {
        string card = "";
        if (chkcard.Checked)
            card = txbcardnum.Text;
        else if (!chkmoney.Checked)
            WebHelper.Alert("请选择现金支付类型：打卡或现金支付");
        else
            card = "0";
        Apply apply = new Apply();
        apply.apply_noid = Convert.ToInt32(lblnoid.Text);
        apply.apply_name = txbname.Text;
        apply.apply_address = txbaddress.Text;
        apply.apply_phone = txbphone.Text;
        apply.apply_checkstate = 5;
        apply.apply_time = dtimebox.Text;
        //Response.Write(dtimebox.Text);
       // Response.End();
        apply.apply_passed = 3;
        apply.apply_street = lblStreet.Text;
        apply.apply_yearincome = float.Parse(this.Request["txbtotleincome"]);
        apply.apply_peoplenum = Int32.Parse(this.Request["txbpeoplenum"]);
        apply.apply_avgincome = float.Parse(this.Request["txbavgincome"]);
        apply.apply_totlearea = float.Parse(this.Request["txbtotlearea"]);
        apply.apply_avgarea = float.Parse(this.Request["txbavgarea"]);
        apply.apply_totlepropertity = float.Parse(this.Request["txbtotleproperty"]);
        apply.apply_paybycard = card;
        apply.apply_docname = rbldoc.SelectedItem.Text;
        apply.apply_docnum = txbproofnum.Text;
        apply.apply_docdate = (Convert.ToInt32(ddlyear4.SelectedItem.Value) * 100 + Convert.ToInt32(ddlmonth4.SelectedItem.Value)).ToString();
        apply.apply_longid = "";
        apply.apply_updchecked = 1;

        string html = "";
        html=Server.HtmlEncode(this.Request["historyhtmlInput"]);
        html = html.Replace("'", "\"");
        apply.HTML = html;
        if (ckbsubsidy.Checked)
        {
            apply.SubsidyMoney = float.Parse(this.Request["submoney"]);
        }
        if (!string.IsNullOrEmpty(this.Request["reducemoney"]) && !ckbsubsidy.Checked)
            apply.SubsidyMoney = float.Parse(this.Request["reducemoney"]);
        
        apply.EditYearMonth = (Convert.ToInt32(startYear.SelectedItem.Value) * 100 + Convert.ToInt32(startMonth.SelectedItem.Value)).ToString();
        apply.EditNote = this.EditNote.Text;
        int succApplyid = apply.AddNewApplyHistory(apply);
        //if (succApplyid > 0)
        //{
        //    //添加Application
        //    Applicant applicant = new Applicant();
        //    applicant.app_applyid = succApplyid;
        //    applicant.app_noid = Int32.Parse(lblnoid.Text);
        //    applicant.app_title = txbapplytitle.Text;
        //    applicant.app_name = txbname.Text;
        //    applicant.app_marryed = ddlmarryed.SelectedValue;
        //    applicant.app_workunit = txbunit.Text;
        //    applicant.app_idcard = txbcard.Text;
        //    applicant.app_income = float.Parse(string.IsNullOrEmpty(txbincome.Text) ? "0" : txbincome.Text);
        //    if (ckbispro.Checked == true)
        //        applicant.app_ispro = 1;
        //    else
        //        applicant.app_ispro = 0;
        //    applicant.AddNewApplicant(applicant);

        //    for (int i = 1; i < 10; i++)
        //    {
        //        short ckbiprovalue = 0;
        //        if (!string.IsNullOrEmpty(this.Request["txbapplytitle" + i]) && !string.IsNullOrEmpty(this.Request["txbname" + i]))
        //        {
        //            if (this.Request["ckbispro" + i] == "on")
        //                ckbiprovalue = 1;
        //            string marryed = this.Request["ddlmarry" + i];
        //            applicant = new Applicant();
        //            applicant.app_applyid = succApplyid;
        //            applicant.app_noid = Int32.Parse(lblnoid.Text);
        //            applicant.app_title = this.Request["txbapplytitle" + i];
        //            applicant.app_name = this.Request["txbname" + i];
        //            applicant.app_marryed = marryed;
        //            applicant.app_workunit = this.Request["txbunit" + i];
        //            applicant.app_idcard = this.Request["txbcard" + i];
        //            applicant.app_income = float.Parse(this.Request["txbincome" + i]);
        //            applicant.app_ispro = ckbiprovalue;
        //            applicant.AddNewApplicant(applicant);
        //        }
        //    }

        //    //添加享受类型，填入历史记录表
        //    string redname = "";
        //    string redaddress = "";
        //    string redarea = "";
        //    string redmoney = "";
        //    string redred = "";
        //    string kindarea = "";
        //    string kindusearea = "";
        //    string kindaddress = "";
        //    if (!string.IsNullOrEmpty(this.Request["username"]))
        //        redname = this.Request["username"];
        //    if (!string.IsNullOrEmpty(this.Request["address"]))
        //        redaddress = this.Request["address"];
        //    if (!string.IsNullOrEmpty(this.Request["area"]))
        //        redarea = this.Request["area"];
        //    if (!string.IsNullOrEmpty(this.Request["checkmoney"]))
        //        redmoney = this.Request["checkmoney"];
        //    if (!string.IsNullOrEmpty(this.Request["reducemoney"]))
        //        redred = this.Request["reducemoney"];
        //    if (!string.IsNullOrEmpty(this.Request["housearea"]))
        //        kindarea = this.Request["housearea"];
        //    if (!string.IsNullOrEmpty(this.Request["usearea"]))
        //        kindusearea = this.Request["usearea"];
        //    if (!string.IsNullOrEmpty(this.Request["houseaddress"]))
        //        kindaddress = this.Request["houseaddress"];
        //    if (ckbsubsidy.Checked)
        //    {
        //        SubsidyRecord subsidy = new SubsidyRecord();
        //        subsidy.Adj_noid = Request.QueryString["id"].ToString();
        //        subsidy.Adj_longid = "";
        //        subsidy.Adj_checked = "1";
        //        subsidy.Adj_nowarea = this.Request["subarea"];
        //        subsidy.Adj_nowmoney = this.Request["submoney"];
        //        subsidy.Adj_moneychange = "0";
        //        subsidy.Adj_iscontinue = "0";
        //        //审核最终通过后设置下个月为起始时间
        //        subsidy.Adj_starttime = "";
        //        if (ddlyear1.SelectedValue == "无期")
        //            subsidy.Adj_stoptime = "-1";
        //        else
        //            subsidy.Adj_stoptime = (Convert.ToInt32(ddlyear1.SelectedItem.Value) * 100 + Convert.ToInt32(ddlmonth1.SelectedItem.Value)).ToString();
        //        subsidy.Adj_remark = "";
        //        subsidy.Adj_date = (DateTime.Now.Year * 100 + DateTime.Now.Month).ToString();
        //        subsidy.AddNewSubsidyRecord(subsidy);
        //    }
        //    if (ckbreduce.Checked)
        //    {
        //        ReduceRecord reduce = new ReduceRecord();
        //        reduce.Adj_longid = "";
        //        reduce.Adj_noid = Request.QueryString["id"].ToString();
        //        reduce.Adj_iscontinue = "0";
        //        reduce.Adj_checked = "1";
        //        reduce.Adj_date = (DateTime.Now.Year * 100 + DateTime.Now.Month).ToString();
        //        reduce.Adj_nowarea = redarea;
        //        reduce.Adj_nowmoney = redmoney;
        //        reduce.Adj_nowreduce = redred;
        //        reduce.Adj_reducechange = "0";
        //        reduce.Adj_remark = "";
        //        reduce.Adj_rentaddress = redaddress;
        //        reduce.Adj_renter = redname;
        //        reduce.Adj_starttime = "";
        //        if (ddlyear2.SelectedValue == "无期")
        //            reduce.Adj_stoptime = "-1";
        //        else
        //            reduce.Adj_stoptime = (Convert.ToInt32(ddlyear2.SelectedItem.Value) * 100 + Convert.ToInt32(ddlmonth2.SelectedItem.Value)).ToString();
        //        reduce.AddNewReduceRecord(reduce);
        //    }
        //    if (ckbkind.Checked)
        //    {
        //        KindRecord kind = new KindRecord();
        //        kind.Adj_checked = "1";
        //        kind.Adj_date = (DateTime.Now.Year * 100 + DateTime.Now.Month).ToString();
        //        kind.Adj_iscontinue = "0";
        //        kind.Adj_location = kindaddress;
        //        kind.Adj_longid = "";
        //        kind.Adj_noid = Request.QueryString["id"].ToString();
        //        kind.Adj_nowarea = kindarea;
        //        kind.Adj_nowuserarea = kindusearea;
        //        kind.Adj_remark = "";
        //        kind.Adj_starttime = "";
        //        if (ddlyear3.SelectedValue == "无期")
        //            kind.Adj_stoptime = "-1";
        //        else
        //            kind.Adj_stoptime = (Convert.ToInt32(ddlyear3.SelectedItem.Value) * 100 + Convert.ToInt32(ddlmonth3.SelectedItem.Value)).ToString();
        //        kind.Adj_usechange = "0";
        //        kind.AddNewKindRecord(kind);
        //    }

        //    //添加财产情况
        //    string securitie = "0", estate = "0", device = "0", others = "0";
        //    if (!string.IsNullOrEmpty(txbsecuritie.Text))
        //        securitie = txbsecuritie.Text;
        //    if (!string.IsNullOrEmpty(txbestate.Text))
        //        estate = txbestate.Text;
        //    if (!string.IsNullOrEmpty(txbdevice.Text))
        //        device = txbdevice.Text;
        //    if (!string.IsNullOrEmpty(txbothers.Text))
        //        others = txbothers.Text;
        //    Property property = new Property();
        //    property.pro_applyid = succApplyid;
        //    property.pro_noid = Int32.Parse(lblnoid.Text);
        //    property.pro_securitie = float.Parse(securitie);
        //    property.pro_estat = float.Parse(estate);
        //    property.pro_device = float.Parse(device);
        //    property.pro_other = float.Parse(others);
        //    property.AddNewProperty(property);

        //    //添加住房情况
        //    HouseSituation house = new HouseSituation();
        //    if (!string.IsNullOrEmpty(txblocal.Text) && !string.IsNullOrEmpty(txbarea.Text) && !string.IsNullOrEmpty(txbowner.Text))
        //    {
        //        house.hou_applyid = succApplyid;
        //        house.hou_noid = Int32.Parse(lblnoid.Text);
        //        house.hou_address = txblocal.Text;
        //        house.hou_area = float.Parse(txbarea.Text);
        //        house.hou_owner = txbowner.Text;
        //        house.hou_ownproof = txbownproof.Text;
        //        house.hou_nature = txbnature.Text;
        //        house.hou_remark = txbremark.Text;
        //        if (ckbaddcount.Checked == true)
        //            house.hou_addcounted = "1";
        //        else
        //            house.hou_addcounted = "0";
        //        house.AddNewHouseSituation(house);
        //    }
        //    for (int i = 1; i < 10; i++)
        //    {
        //        string ckbaddcountvalue = "0";
        //        if (!string.IsNullOrEmpty(this.Request["txblocal" + i]) && !string.IsNullOrEmpty(this.Request["txbarea" + i]) && !string.IsNullOrEmpty(this.Request["txbowner" + i]))
        //        {
        //            if (this.Request["ckbaddcount" + i] == "on")
        //                ckbaddcountvalue = "1";
        //            house = new HouseSituation();
        //            house.hou_applyid = succApplyid;
        //            house.hou_noid = Convert.ToInt32(lblnoid.Text);
        //            house.hou_address = this.Request["txblocal" + i];
        //            house.hou_area = float.Parse(this.Request["txbarea" + i]);
        //            house.hou_owner = this.Request["txbowner" + i];
        //            house.hou_ownproof = this.Request["txbownproof" + i];
        //            house.hou_nature = this.Request["txbnature" + i];
        //            house.hou_remark = this.Request["txbremark" + i];
        //            house.hou_addcounted = ckbaddcountvalue;
        //            house.AddNewHouseSituation(house);
        //        }
        //    }
        //    Admissibility admissibility = new Admissibility();
        //    admissibility.SetAdmissibilityAdded(lblnoid.Text);
        //    WebHelper.AlertAndCloseThenRefreshLastPage("录入成功！");
        //}
        //else
        //    WebHelper.Alert("数据录入失败，请重新操作!");
    }
}
